<template>
    <transition :name="animateName" appear>
        <div class="loadings" v-show="show.value">
            <div class="loadings__img">
                <div class="loadings__img__txt">{{text.value}}</div>
            </div>
        </div>
    </transition>
</template>
<script setup>
    import {
        ref
    } from 'vue'
    const animateName = ref('opacity')
    defineProps({
        show: Object,
        text: Object,
    })
</script>

<style scope>
    .loadings__img {
        position: fixed;
        z-index: 9999999;
    }

    .loadings__img {
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translate3d(-50%, -50%, 0);
        transform: translate3d(-50%, -50%, 0);
        background-color: #1a1b1d;
        color: #fff;
        padding: .2rem .3rem;
        border-radius: .1rem;
        text-align: center;
    }

    .loadings__img__txt {
        font-size: .24rem;
        background: url('https://n.sinaimg.cn/finance/weexreport/load_icon_night.gif') no-repeat;
        background-size: .7rem .7rem;
        background-position: 50% 0;
        padding: .8rem 0 0;
    }

    .loadings__img img {
        width: .7rem;
        margin-bottom: .1rem;
    }

    .loadings__loader {
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translate3d(-50%, -50%, 0);
        transform: translate3d(-50%, -50%, 0);
        display: none;
    }

    .loadings__loader__dot {
        width: .23rem;
        height: .23rem;
        background: #3ac;
        border-radius: 100%;
        display: inline-block;
        -webkit-animation: slide 1s infinite;
        animation: slide 1s infinite;
        margin-right: .2rem;
    }

    .loadings__loader__dot:first-child {
        -webkit-animation-delay: .3s;
        animation-delay: .3s;
        background: #dc3535;
    }

    .loadings__loader__dot:nth-child(2) {
        -webkit-animation-delay: .4s;
        animation-delay: .4s;
        background: #e04f4f;
    }

    .loadings__loader__dot:nth-child(3) {
        -webkit-animation-delay: .5s;
        animation-delay: .5s;
        background: #e56969;
    }

    .loadings__loader__dot:nth-child(4) {
        -webkit-animation-delay: .6s;
        animation-delay: .6s;
        background: #e98383;
    }

    .loadings__loader__dot:nth-child(5) {
        -webkit-animation-delay: .7s;
        animation-delay: .7s;
        background: #ee9d9d;
    }

    .opacity-enter-active {
        animation: sf-fade-in .4s
    }

    .opacity-leave-active {
        animation: sf-fade-in .4s reverse
    }


    @keyframes sf-fade-in {
        0% {
            opacity: 0;
        }
    }
</style>